import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { GLOBAL } from '../../../../config/global';
const scale = GLOBAL.SCALE;
const styles = StyleSheet.create({
	tagWrap: {
		borderRadius: 11 * scale,
		height: 22 * scale,
		width: 22 * scale
	},
	tagText: {
		fontSize: 13 * scale,
		textAlign: 'center',
		fontWeight: 'bold'
	},
})
export const purchaseTag = <Text style={[styles.tagText, { color: '#82CD4B' }]}>采</Text>

export const saleTag = <Text style={[styles.tagText, { color: '#F5A623' }]}>销</Text>

export const currency = (value, units, style) => {
	let { valueColor } = style || {};
	value = value || 0
	let valueArr = (value + '').split('.')
	return (<View style={{ flexDirection: 'row', alignItems: "flex-end" }}>
		<Text style={{ fontSize: 16 * scale, color: valueColor ? valueColor : '#000000' }}>{valueArr[0] || 0}</Text>
		<Text style={{ fontSize: 12 * scale, color: valueColor ? valueColor : '#000000', paddingBottom: 2 * scale }}>.{valueArr[1] || '00'}{units}</Text>
	</View>)
}

export const betweenLayout = (label, value, styleObj) => {
	let { nofixLeft, tag, fontSize } = styleObj || {};
	fontSize = fontSize ? fontSize : 14;
	return (<View style={[{
		flexDirection: 'row',
		justifyContent: 'space-between',
		paddingTop: 7 * scale,
		paddingBottom: 7 * scale,
		paddingLeft: 24 * scale,
		paddingRight: 25 * scale
	}, nofixLeft ? null : { justifyContent: 'flex-start' }]}>
		<View style={[{ flexDirection: 'row' }, nofixLeft ? null : { width: 105 * scale }]}>
			<Text style={[{
				fontSize: fontSize * scale,
				marginRight: 8 * scale,
				color: '#000000',
			}, nofixLeft ? null : { width: 75 * scale, textAlign: 'right' }]}>{label}</Text>
			{tag ? tag : null}
		</View>
		<Text style={[{
			fontSize: fontSize * scale,
			color: '#000000',
			fontWeight: 'bold',
			maxWidth: 220 * scale
		}]}>{value}</Text>
	</View>)
}

